#include <linux/cpu.h>
#include <linux/notifier.h>
#include <asm/dom_fw_dom0.h>
+#include <asm-generic/sections.h>
typedef asmlinkage NORET_TYPE void (*relocate_new_kernel_t)(
unsigned long indirection_page,
static int machine_kexec_get_xen(xen_kexec_range_t *range)
{
- range->start = virt_to_maddr(_start);
+ range->start = range->start = ia64_tpa(_text);
+ range->size = (unsigned long)_end - (unsigned long)_text;
+ return 0;
+}
+
+#define ELF_PAGE_SHIFT 16
+#define ELF_PAGE_SIZE (__IA64_UL_CONST(1) << ELF_PAGE_SHIFT)
+#define ELF_PAGE_MASK (~(ELF_PAGE_SIZE - 1))
+
+static int machine_kexec_get_xenheap(xen_kexec_range_t *range)
+{
+ range->start = (ia64_tpa(_end) + (ELF_PAGE_SIZE - 1)) & ELF_PAGE_MASK;
range->size = (unsigned long)xenheap_phys_end -
(unsigned long)range->start;
return 0;
}
+static int machine_kexec_get_boot_param(xen_kexec_range_t *range)
+{
+ range->start = __pa(ia64_boot_param);
+ range->size = sizeof(*ia64_boot_param);
+ return 0;
+}
+
+static int machine_kexec_get_efi_memmap(xen_kexec_range_t *range)
+{
+ range->start = ia64_boot_param->efi_memmap;
+ range->size = ia64_boot_param->efi_memmap_size;
+ return 0;
+}
+
int machine_kexec_get(xen_kexec_range_t *range)
{
- if (range->range != KEXEC_RANGE_MA_XEN)
- return -EINVAL;
- return machine_kexec_get_xen(range);
+ switch (range->range) {
+ case KEXEC_RANGE_MA_XEN:
+ return machine_kexec_get_xen(range);
+ case KEXEC_RANGE_MA_XENHEAP:
+ return machine_kexec_get_xenheap(range);
+ case KEXEC_RANGE_MA_BOOT_PARAM:
+ return machine_kexec_get_boot_param(range);
+ case KEXEC_RANGE_MA_EFI_MEMMAP:
+ return machine_kexec_get_efi_memmap(range);
+ }
+ return -EINVAL;
}
/*
xen_kexec_image_t image;
} xen_kexec_load_t;
-#define KEXEC_RANGE_MA_CRASH 0 /* machine address and size of crash area */
-#define KEXEC_RANGE_MA_XEN 1 /* machine address and size of Xen itself */
-#define KEXEC_RANGE_MA_CPU 2 /* machine address and size of a CPU note */
+#define KEXEC_RANGE_MA_CRASH 0 /* machine address and size of crash area */
+#define KEXEC_RANGE_MA_XEN 1 /* machine address and size of Xen itself */
+#define KEXEC_RANGE_MA_CPU 2 /* machine address and size of a CPU note */
+#define KEXEC_RANGE_MA_XENHEAP 3 /* machine address and size of xenheap
+ * Note that although this is adjacent
+ * to Xen it exists in a separate EFI
+ * region on ia64, and thus needs to be
+ * inserted into iomem_machine separately */
+#define KEXEC_RANGE_MA_BOOT_PARAM 4 /* machine address and size of
+ * the ia64_boot_param */
+#define KEXEC_RANGE_MA_EFI_MEMMAP 5 /* machine address and size of
+ * of the EFI Memory Map */
/*
* Find the address and size of certain memory areas